import {$post,$get,$delete,$put} from '../utils/request'
import md5 from 'md5'

// 登录
export let $login = async (params)=>{
  params.loginPwd = md5(md5(params.loginPwd).split('').reverse().join(''))
  let ret = await $post('/admin/login',params)
  return ret
}

// 获取用户列表
export let $list = async (params)=>{
  let {data} = await $get('/admin/list',params)
  return data
}

// 添加用户
export let $add = async (params)=>{
  params.loginPwd = md5(md5(params.loginPwd).split('').reverse().join(''))
  let ret = await $post('/admin/add',params)
  return ret
}

// 根据账号获取用户
export let $findByLoginId = async (params)=>{
  let {data} = await $get('/admin/findByLoginId',params)
  return data
}

// 删除用户
export let $delByLoginId = async (params)=>{
  let ret = await $delete('/admin/delete',params)
  return ret
}

// 修改用户
export let $upByLoginId = async (params)=>{
  let ret = await $put('/admin/update',params)
  return ret
}